package cn.dac.common;

public enum LoginStatusEnum {
    UNKNOWN_ACCOUNT("01","未知账户"),
    INCORRECT_CREDENTIALS("02","密码不正确"),
    VERIFICATION_CODE_ERROR("03","验证码不正确"),
    EXCESSIVE_ATTEMPTS("04","密码错误次数过多,请15分钟后重试"),
    ACCOUNT_LOCKED("05","账户已锁定"),
    DEFAULT("00","用户名或密码不正确"),
    ;


    private String code;
    private String message;
    LoginStatusEnum(String code, String message){
        this.code = code;
        this.message = message;
    }
    public static String getMessageByCode(String code) {
        if(code==null || "".equals(code))return null;
        for (LoginStatusEnum loginStatusEnum : LoginStatusEnum.values()) {
            if (loginStatusEnum.getCode().equals(code)) {
                return loginStatusEnum.getMessage();
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
